﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ITAP.ShprossesBuilder.Modelling.Components;
using ITAP.ShprossesBuilder.Properties;

namespace ITAP.ShprossesBuilder.Operations
{
    public class OperationComponentLayoutBringToFront : IOperation
    {
        #region IOperation Members

        public string Name
        {
            get { return "Переместить вперёд"; }
        }

        public OperationGroup OperationGroup
        {
            get { return OperationGroup.ShprossOperation; }
        }

        public System.Drawing.Image Thumbnail
        {
            get { return Resources.ShprossBringToFront.ToBitmap(); }
        }

        public void Execute(ModelControl modelControl)
        {
            foreach (IComponent selectedComponent in modelControl.ModelContainer.SelectedComponentsStack)
            {
                if (selectedComponent.Parent is Model && selectedComponent is Shpross)
                {
                    Model model = selectedComponent.Parent as Model;
                    model.InnerComponents.MoveToEnd(selectedComponent);
                }
            }
        }

        public bool CanUndo
        {
            get { return false; }
        }

        #endregion
    }
}
